package org.zfes.snowier.cloud.zbss.pmp.router.service.dev;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.auth.shiro.util.SecurityUtil;
import org.zfes.snowier.cloud.zbss.pmp.dto.PmpBugsSubmitDto;
import org.zfes.snowier.cloud.zbss.pmp.model.PmpBugsRecord;
import org.zfes.snowier.cloud.zbss.pmp.service.IPmpBugsRecordService;
import org.zfes.snowier.cloud.zbss.pmp.service.IPmpBugsService;
@Controller("org.zfes.snowier.cloud.zbss.pmp.router.service.dev.pmpBugsController") 
@RequestMapping("/pmp/service/dev/pmpBugs")
public class PmpBugsController extends BaseController {

	
	@Autowired
	private IPmpBugsService pmpBugsService;

	@Autowired
	private IPmpBugsRecordService pmpBugsRecordService;
	
	
	
    @RequestMapping(value="/submitBugs", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object  submitBugs(PmpBugsSubmitDto bugsSubmitDto) {
    	pmpBugsService.submitBugs(SecurityUtil.getUserId().get(),bugsSubmitDto);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
    
	@RequestMapping(value="/loadRecordByBugId", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadRecordByBugId(Long bugId){
		List<PmpBugsRecord> recordList=  pmpBugsRecordService.loadRecordByBugId(bugId);
	    return ajaxQuery("recordList", recordList);
    }
    
    
}